package net.dopan.pigframe.demo.service;

import net.dopan.pigframe.core.base.service.BaseService;
import net.dopan.pigframe.demo.model.entity.CommentLike;
import net.dopan.pigframe.demo.model.entity.UserActivity;
import net.dopan.pigframe.demo.model.entity.vo.*;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;
import java.util.Map;

@CacheConfig(cacheNames = "USERSERVICE")
public interface UserActivityService extends BaseService<UserActivity> {

    @CacheEvict(cacheNames = "USERSERVICE", key = "'userActivity_' + #userActivity.userId")
    Boolean addUserActivity(UserActivity userActivity, boolean flag);

    @Cacheable(cacheNames = "USERSERVICE", key = "'userActivity_'+ #activityId")
    UserActivity getUserActivity(Integer activityId);

    Integer findMaxId();

    Integer findEntryActivityNum(Integer activityId);

    @Cacheable(value = "findUserActivityVo#120")
    List<UserActivityVo> findUserActivityVo(Map<String, String> map);
    @Cacheable(value = "getActivityDetail#120")
    List<UserActivityVo> getActivityDetail(String activityId, String userId);
    @Cacheable(value = "getNoteDetail#120")
    List<Map<String, String>> getNoteDetail(String noteId, String userId);
    /**
     * 查找照片墙
     */
//    @Cacheable(key = "'PhotoWall'+#activityId")
    List<Map<String, String>> getPhotoWall(String activityId, String userId);

    /**
     * 添加图片到图片墙
     */
//    @CachePut(key = "'PhotoWall'+#activityId")
    Boolean addPhotoIntoWall(Integer activityId, String photoUrl, String userId);

    /**
     * 添加活动评论
     */
    Boolean addActivityComment(ActivityCommentVo activityCommentVo);

    /**
     * 添加笔记评论
     */
    Boolean addUserNoteComment(String noteId, String userId, String commentMsg, String commentNum);

    /**
     * 获取活动评论总数
     */
    Integer getCommentNum(String activityId);

    /**
     * 获取笔记评论总数
     */
    Integer getNoteCommentNum(String noteId);

    /**
     * 添加活动评论回复
     */
    Boolean addCommentReply(CommentReplyBo commentReplyBo);

    /**
     * 添加笔记评论回复
     */
    Boolean addNoteCommentReply(String userId, String commentId, String replyMsg);

    /**
     * 活动点赞查询
     */
    CommentLike findCommentLik(String commentId, String userId);

    /**
     * 评论点赞查询
     */
    List<Map<String, String>> findNoteCommentLike(String commentId, String userId);

    /**
     * 删除活动点赞
     */
    Integer delCommentLik(String commentLikeId);
    /**
     * 删除评论点赞
     */
    Integer delNoteCommentLik(String likeId);

    /**
     * 点赞活动评论
     */
    Integer addCommentLik(String commentId, String userId);
    /**
     * 点赞笔记评论
     */
    Integer addNoteCommentLik(String commentId, String userId);

    /**
     * 获取活动单条评论点赞数
     */
    Integer getCommentLikNum(String commentId);
    /**
     * 获取评论单条评论点赞数
     */
    Integer getNoteCommentLikNum(String commentId);
    /**
     * 活动评论及回复
     */
    List<ActivityCommentAndReplyVo> getCommentAndReply(String activityId, String userId);
    /**
     * 笔记评论及回复
     */
    List<NoteCommentAndReplyVo> getNoteCommentAndReply(String noteId, String userId);

    /**
     * 更新活动评论点赞数
     */
    Integer saveOrUpdateLikeNum(String likeNum, String commentId);
    /**
     * 更新笔记评论点赞数
     */
    Integer updateNoteCommentLikeNum(String likeNum, String commentId);
    /**
     * 用户活动点赞查询
     */
    List<Map<String, String>> getUserActivityLikeMap(String activityId, String userId);
    /**
     * 用户笔记点赞查询
     */
    List<Map<String, String>> getUserNoteLikeMap(String noteId, String userId);

    /**
     * 用户收藏活动查询
     */
    List<Map<String, String>> getUserActivityCollectMap(String activityId, String userId);

    /**
     * 用户收藏笔记查询
     */
    List<Map<String, String>> getUserNoteCollectMap(String noteId, String userId);

    /**
     * 删除用户活动点赞
     */
    void delUserActivityLikeMap(String activityId, String userId);

    /**
     * 删除用户笔记点赞
     */
    void delUserNoteLikeMap(String noteId, String userId);
    /**
     * 删除用户活动收藏
     */
    @CacheEvict(cacheNames = "USERCONCERNUSER", key = "'findUserCollectMap'+#userId")
    void delUserActivityCollectMap(String activityId, String userId);
    /**
     * 删除用户笔记收藏
     */
//    @CacheEvict(cacheNames = "USERCONCERNUSER", key = "'findUserCollectMap'+#userId")
    void delUserNoteCollectMap(String noteId, String userId);

    /**
     * 用户活动点赞
     */
    @CacheEvict(cacheNames = "USERSERVICE", key = "'getLikeUserActivity' + #userId")
    void addUserActivityLikeMap(String activityId, String userId);

    /**
     * 用户笔记点赞
     */
//    @CacheEvict(cacheNames = "USERSERVICE", key = "'getLikeUserActivity' + #userId")
    void addUserNoteLikeMap(String noteId, String userId);

    /**
     * 用户活动收藏
     */
    @CacheEvict(cacheNames = "USERCONCERNUSER", key = "'findUserCollectMap'+#userId")
    void addUserActivityCollectMap(String activityId, String userId);

    /**
     * 用户笔记收藏
     */
//    @CacheEvict(cacheNames = "USERCONCERNUSER", key = "'findUserCollectMap'+#userId")
    void addUserNoteCollectMap(String noteId, String userId);

    /**
     * 查询参加活动的人
     */
    List<Map<String, String>> getUserActivityParticipant(Integer activityId, Integer userId);

    /**
     * 查询用户身份验证
     */
    Integer getIdentityVerification(String userId);

    /**
     * 用户照片墙照片点赞查询
     */
    List<Map<String, String>> getPhotoWallLike(String wallId, String userId);

    /**
     * 照片墙照片点赞
     */
    void addPhotoWallLike(String wallId, String userId);

    /**
     * 删除照片墙照片点赞
     */
    void delPotoWallLike(String wallId, String userId);

    void updateIdentityVrification(String userId);
}
